package com.zdglf.mmd;

import android.app.Application;

import com.tencent.bugly.Bugly;
import com.zdglf.mmd.utils.FileUtils;

import java.io.File;

/**
 * Created by zhangmike on 1/1/17.
 */
public class MMDApplication extends Application {
    String appID = "33573c3d01";
    @Override
    public void onCreate() {
        super.onCreate();
        int[] res = new int[]{R.raw.toon00, R.raw.toon01, R.raw.toon02, R.raw.toon03, R.raw.toon04, R.raw.toon05,
                R.raw.toon06, R.raw.toon07, R.raw.toon08, R.raw.toon09, R.raw.toon10};
        for(int i = 0;i < res.length;i++){
            String fileName = String.format("toon%02d.bmp", i);
            fileName = getFilesDir().toString()+"/"+fileName;
            File f = new File(fileName);
            if(!f.exists()){
                FileUtils.copyToFath(getResources().openRawResource(res[i]), fileName);
            }
        }

        Bugly.init(getApplicationContext(), appID, true);

    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }
}
